//
//  HNightQualityTableViewCell.m
//  NursingManages
//
//  Created by Zhen Huang on 17/6/19.
//  Copyright © 2017年 huangzhen. All rights reserved.
//

#import "HNightQualityTableViewCell.h"

@implementation HNightQualityTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.reduceLabel];
        [self.contentView addSubview:self.textview];
    }
    return self;
}
- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth - 20, 30)];
    }
    return _titleLabel;
}

- (UILabel *)reduceLabel
{
    if (!_reduceLabel) {
        _reduceLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.titleLabel.bottom + 10, ScreenWidth - 20, 30)];
        _reduceLabel.text = @"问题描述:";
    }
    return _reduceLabel;
}
- (UITextField *)textview
{
    if (!_textview ) {
        _textview = [[UITextField alloc]initWithFrame:CGRectMake(10, self.reduceLabel.bottom + 10, ScreenWidth - 20, 40)];
        _textview.delegate = self;
        _textview.layer.borderWidth = 0.1;
        _textview.layer.cornerRadius = 6.0;
        _textview.layer.masksToBounds = YES ;
    }
    return _textview;
}

//- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
//{
//    if (_savedata) {
//        _savedata[(textView.text stringByReplacingOccurrencesOfString:range withString:text)];
//    }
//}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if (_savedata) {
        _savedata([textField.text stringByReplacingCharactersInRange:range withString:string]);
    };
    return YES;
}
- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
